Imports System.ComponentModel

<Description("Contains helper static (shared) members for working with wrapper objects.")> _
Public Class WrapperHelper
	<Description("Is specidifed object implements interface 'IWrapper' then returns result of 'GetWrappedObject()' calling. Otherwise return specified object.")> _
	Public Shared Function GetWrappedObjectIfCan(ByVal obj As Object) As Object
		If obj Is Nothing Then
			Return Nothing
		ElseIf TypeOf obj Is IWrapper Then
			Dim tmp As IWrapper = obj
			Dim result As Object = tmp.GetWrappedObject()
			Return result
		End If

		Return obj
	End Function

	Public Shared Sub GCCollect()
		GC.WaitForPendingFinalizers()
		GC.Collect()
		GC.WaitForPendingFinalizers()
		GC.Collect()
	End Sub
End Class
